package com.doublefish.doublefishrobot.utils;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;

/**
 * Created by peak on 2024/10/15
 */
public class ToastUtil {

    public static void showToast(final Context context, final String toast) {
        if (context == null || toast == null) {
            return;
        }
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(context, "" + toast, Toast.LENGTH_SHORT).show();
            }
        });
    }

    public static void showToastLong(final Context context, final String toast) {
        if (context == null || toast == null) {
            return;
        }
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(context, "" + toast, Toast.LENGTH_LONG).show();
            }
        });
    }

}